\hypertarget{reactor_8nxc}{
\section{workspace/WR/Source/reactor.nxc File Reference}
\label{reactor_8nxc}\index{workspace/WR/Source/reactor.nxc@{workspace/WR/Source/reactor.nxc}}
}


A program allowing our robot to search for reactor.  


{\ttfamily \#include \char`\"{}utils.h\char`\"{}}\par
{\ttfamily \#include \char`\"{}communication.h\char`\"{}}\par
{\ttfamily \#include \char`\"{}move.h\char`\"{}}\par
{\ttfamily \#include \char`\"{}music.h\char`\"{}}\par
\subsection*{Defines}
\begin{DoxyCompactItemize}
\item 
\hypertarget{reactor_8nxc_a738b9657b067e383cd066d4c7ca6f576}{
\#define \hyperlink{reactor_8nxc_a738b9657b067e383cd066d4c7ca6f576}{CPWR\_\-B}~60}
\label{reactor_8nxc_a738b9657b067e383cd066d4c7ca6f576}

\begin{DoxyCompactList}\small\item\em Base speed of robot. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_ae382ea7d9a3437076c5616056836377a}{
\#define \hyperlink{reactor_8nxc_ae382ea7d9a3437076c5616056836377a}{CPWR\_\-S}~40}
\label{reactor_8nxc_ae382ea7d9a3437076c5616056836377a}

\begin{DoxyCompactList}\small\item\em Slow speed of robot. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_ac9341f36c8b85c8d70f06973c2d9a5bd}{
\#define \hyperlink{reactor_8nxc_ac9341f36c8b85c8d70f06973c2d9a5bd}{FRONT\_\-MIN}~29}
\label{reactor_8nxc_ac9341f36c8b85c8d70f06973c2d9a5bd}

\begin{DoxyCompactList}\small\item\em Front light settings. Minimal front light distance from fence for safe operating. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_acb1164349a1fa4b7052e28f7c7c735d4}{
\#define \hyperlink{reactor_8nxc_acb1164349a1fa4b7052e28f7c7c735d4}{FFRONTAL\_\-REVT}~300}
\label{reactor_8nxc_acb1164349a1fa4b7052e28f7c7c735d4}

\begin{DoxyCompactList}\small\item\em Bumper settings. Rev time if full frontal crash. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_abda398fa4722b8691dc8c52c733a2814}{
\#define \hyperlink{reactor_8nxc_abda398fa4722b8691dc8c52c733a2814}{FFRONTAL\_\-RANGLE}~70}
\label{reactor_8nxc_abda398fa4722b8691dc8c52c733a2814}

\begin{DoxyCompactList}\small\item\em Bumper settings. Angle (in degrees) to turn if side right frontal crash. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_aac0491bc7a39228e57b85de235ef59eb}{
\#define \hyperlink{reactor_8nxc_aac0491bc7a39228e57b85de235ef59eb}{LFRONTAL\_\-REVT}~300}
\label{reactor_8nxc_aac0491bc7a39228e57b85de235ef59eb}

\begin{DoxyCompactList}\small\item\em Bumper settings. Rev time if side left frontal crash. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_ad19631fb45582ad9441719c376c07c3b}{
\#define \hyperlink{reactor_8nxc_ad19631fb45582ad9441719c376c07c3b}{LFRONTAL\_\-RANGLE}~60}
\label{reactor_8nxc_ad19631fb45582ad9441719c376c07c3b}

\begin{DoxyCompactList}\small\item\em Bumper settings. Angle (in degrees) to turn if side left frontal crash. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_a623033e48068d57555d513a2d56d0c40}{
\#define \hyperlink{reactor_8nxc_a623033e48068d57555d513a2d56d0c40}{RFRONTAL\_\-REVT}~300}
\label{reactor_8nxc_a623033e48068d57555d513a2d56d0c40}

\begin{DoxyCompactList}\small\item\em Bumper settings. Rev time if side right frontal crash. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_a70438bca69ec65d9a29a9f120922464d}{
\#define \hyperlink{reactor_8nxc_a70438bca69ec65d9a29a9f120922464d}{RFRONTAL\_\-RANGLE}~80}
\label{reactor_8nxc_a70438bca69ec65d9a29a9f120922464d}

\begin{DoxyCompactList}\small\item\em Bumper settings. Angle (in degrees) to turn if side right frontal crash. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_a7861c2174f24a87c43840f87f3cf8a14}{
\#define \hyperlink{reactor_8nxc_a7861c2174f24a87c43840f87f3cf8a14}{FRONT\_\-TT}~100}
\label{reactor_8nxc_a7861c2174f24a87c43840f87f3cf8a14}

\begin{DoxyCompactList}\small\item\em Turn time if danger ahead. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_abac7e3cf78ac568c0622e8497156baf1}{
\#define \hyperlink{reactor_8nxc_abac7e3cf78ac568c0622e8497156baf1}{STAIN\_\-LIGHT}~45}
\label{reactor_8nxc_abac7e3cf78ac568c0622e8497156baf1}

\begin{DoxyCompactList}\small\item\em Stain avoidance. If measurement $<$ this, we've got a radioactive stain. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_a23085c5995bfb533de15f749911735ee}{
\#define \hyperlink{reactor_8nxc_a23085c5995bfb533de15f749911735ee}{STAIN\_\-REVT}~500}
\label{reactor_8nxc_a23085c5995bfb533de15f749911735ee}

\begin{DoxyCompactList}\small\item\em Stain avoidance. Rev time if stain detected. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_aa065f0a3dcd588addce086ed8e16ef21}{
\#define \hyperlink{reactor_8nxc_aa065f0a3dcd588addce086ed8e16ef21}{STAIN\_\-RANGLE}~50}
\label{reactor_8nxc_aa065f0a3dcd588addce086ed8e16ef21}

\begin{DoxyCompactList}\small\item\em Stain avoidance. Turn angle (in degrees) if stain detected. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_a0ffed1b076ac2fe20116fa0f0ae633f1}{
\#define \hyperlink{reactor_8nxc_a0ffed1b076ac2fe20116fa0f0ae633f1}{SCANS\_\-INTERVAL}~15}
\label{reactor_8nxc_a0ffed1b076ac2fe20116fa0f0ae633f1}

\begin{DoxyCompactList}\small\item\em Reactor. The number of program loops that should pass between two reactor scans. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_a3c84fa327c80928102bf5fcd704df9e6}{
\#define \hyperlink{reactor_8nxc_a3c84fa327c80928102bf5fcd704df9e6}{GFI\_\-SCANS\_\-INTERVAL}~10}
\label{reactor_8nxc_a3c84fa327c80928102bf5fcd704df9e6}

\begin{DoxyCompactList}\small\item\em Reactor. Loops between reactor scans when in ST\_\-GO\_\-FOR\_\-IT. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_ad57e5a239da13ddea4ab2548b177dcf3}{
\#define \hyperlink{reactor_8nxc_ad57e5a239da13ddea4ab2548b177dcf3}{REACTOR\_\-AHEAD}~50}
\label{reactor_8nxc_ad57e5a239da13ddea4ab2548b177dcf3}

\begin{DoxyCompactList}\small\item\em Reactor. If light\_\-inactive $>$ this, reactor was spotted. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_a900c7579f499cdcaf00704ae6598036a}{
\#define \hyperlink{reactor_8nxc_a900c7579f499cdcaf00704ae6598036a}{REACTOR\_\-CLOSE}~60}
\label{reactor_8nxc_a900c7579f499cdcaf00704ae6598036a}

\begin{DoxyCompactList}\small\item\em Reactor. If light\_\-inactive $>$ this, reactor is very close. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_a05ff785034efa7b287ee834f9ccb74f1}{
\#define \hyperlink{reactor_8nxc_a05ff785034efa7b287ee834f9ccb74f1}{REACTOR\_\-FOUND}~90}
\label{reactor_8nxc_a05ff785034efa7b287ee834f9ccb74f1}

\begin{DoxyCompactList}\small\item\em Reactor. If l\_\-i $>$ this, reactor was found. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_ae981e3a47c44d4878baa7c830f5b846a}{
\#define \hyperlink{reactor_8nxc_ae981e3a47c44d4878baa7c830f5b846a}{GFI\_\-SFRONTAL\_\-REVT}~1000}
\label{reactor_8nxc_ae981e3a47c44d4878baa7c830f5b846a}

\begin{DoxyCompactList}\small\item\em Reactor. Time spent reversing in ST\_\-GO\_\-FOR\_\-IT state near reactor. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_ae6cb54a3555702c9db09d084dba51143}{
\#define \hyperlink{reactor_8nxc_ae6cb54a3555702c9db09d084dba51143}{GFI\_\-SFRONTAL\_\-RANGLE}~60}
\label{reactor_8nxc_ae6cb54a3555702c9db09d084dba51143}

\begin{DoxyCompactList}\small\item\em Reactor. Turn angle (in degrees) in ST\_\-GO\_\-FOR\_\-IT state near reactor. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_adee1b3613cfe237cecaba8f2d6f8ecdc}{
\#define \hyperlink{reactor_8nxc_adee1b3613cfe237cecaba8f2d6f8ecdc}{GFI\_\-SFRONTAL\_\-FWDT}~1600}
\label{reactor_8nxc_adee1b3613cfe237cecaba8f2d6f8ecdc}

\begin{DoxyCompactList}\small\item\em Reactor. Time spent moving forward in ST\_\-GO\_\-FOR\_\-IT state near reactor. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_a24ced77f76e8a86e359fd77bc1ab9ce2}{
\#define \hyperlink{reactor_8nxc_a24ced77f76e8a86e359fd77bc1ab9ce2}{GFI\_\-MAX\_\-ROT\_\-FAILSAFE}~20}
\label{reactor_8nxc_a24ced77f76e8a86e359fd77bc1ab9ce2}

\begin{DoxyCompactList}\small\item\em Reactor. Robot in ST\_\-GO\_\-FOR\_\-IT state. If rotations reach this num, robot is blocked. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_acf448a4b51caadc3612dd7fe1e6d989c}{
\#define \hyperlink{reactor_8nxc_acf448a4b51caadc3612dd7fe1e6d989c}{GFI\_\-MAX\_\-TIME\_\-NOREACT}~70}
\label{reactor_8nxc_acf448a4b51caadc3612dd7fe1e6d989c}

\begin{DoxyCompactList}\small\item\em Reactor. Robot in ST\_\-GO\_\-FOR\_\-IT state. $\ast$100ms = time that the robot can spend in ST\_\-GO\_\-FOR\_\-IT state if no reactor is seen. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_ab9d3d1049b45438591608c99774c5cba}{
\#define \hyperlink{reactor_8nxc_ab9d3d1049b45438591608c99774c5cba}{LIGHTFRPORT}~IN\_\-2}
\label{reactor_8nxc_ab9d3d1049b45438591608c99774c5cba}

\begin{DoxyCompactList}\small\item\em Front light port. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_a5103b4e7f1559cfe1f24513bd3d797c2}{
\#define \hyperlink{reactor_8nxc_a5103b4e7f1559cfe1f24513bd3d797c2}{LIGHTDOWNPORT}~IN\_\-1}
\label{reactor_8nxc_a5103b4e7f1559cfe1f24513bd3d797c2}

\begin{DoxyCompactList}\small\item\em Down light port. Exchangeable with SONSIDEPORT. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_a73b327cc697b593b06f47bc6915ba9cf}{
\#define \hyperlink{reactor_8nxc_a73b327cc697b593b06f47bc6915ba9cf}{SONSIDEPORT}~IN\_\-1}
\label{reactor_8nxc_a73b327cc697b593b06f47bc6915ba9cf}

\begin{DoxyCompactList}\small\item\em Side ultrasonic sensor port. Exchangeable with LIGHTDOWNPORT. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_a867a2479cd5e144bc98b3e24bd48a79c}{
\#define \hyperlink{reactor_8nxc_a867a2479cd5e144bc98b3e24bd48a79c}{TOUCHLPORT}~IN\_\-4}
\label{reactor_8nxc_a867a2479cd5e144bc98b3e24bd48a79c}

\begin{DoxyCompactList}\small\item\em Left touch sensor port ( Bumper ). \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_ac16330478e7b003e00f37e90e0c5bdf6}{
\#define \hyperlink{reactor_8nxc_ac16330478e7b003e00f37e90e0c5bdf6}{TOUCHRPORT}~IN\_\-3}
\label{reactor_8nxc_ac16330478e7b003e00f37e90e0c5bdf6}

\begin{DoxyCompactList}\small\item\em Right touch sensor port ( Bumper ). \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_a26fd581a2d8a8f58a30535495c8d0843}{
\#define \hyperlink{reactor_8nxc_a26fd581a2d8a8f58a30535495c8d0843}{LIGHTFR}~Sensor(LIGHTFRPORT)}
\label{reactor_8nxc_a26fd581a2d8a8f58a30535495c8d0843}

\begin{DoxyCompactList}\small\item\em Initialize Front light port. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_aadf3c356fd812224ab384f9780155c1a}{
\#define \hyperlink{reactor_8nxc_aadf3c356fd812224ab384f9780155c1a}{LIGHTDW}~Sensor(LIGHTDOWNPORT)}
\label{reactor_8nxc_aadf3c356fd812224ab384f9780155c1a}

\begin{DoxyCompactList}\small\item\em Initialize down light port. Exchangeable with SONSIDE. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_aec1d71dea61f39acce761840c4ce0d27}{
\#define \hyperlink{reactor_8nxc_aec1d71dea61f39acce761840c4ce0d27}{SONSIDE}~SensorUS(SONSIDEPORT)}
\label{reactor_8nxc_aec1d71dea61f39acce761840c4ce0d27}

\begin{DoxyCompactList}\small\item\em Initialize side ultrasonic sensor port. Exchangeable with LIGHTDW. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_a98c4f75c182ff1c7c6f3fb288f4f3857}{
\#define \hyperlink{reactor_8nxc_a98c4f75c182ff1c7c6f3fb288f4f3857}{TOUCHL}~Sensor(TOUCHLPORT)}
\label{reactor_8nxc_a98c4f75c182ff1c7c6f3fb288f4f3857}

\begin{DoxyCompactList}\small\item\em Initialize left touch sensor port ( Bumper ). \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_a6537370af17fd38a56bcf670d8db23e3}{
\#define \hyperlink{reactor_8nxc_a6537370af17fd38a56bcf670d8db23e3}{TOUCHR}~Sensor(TOUCHRPORT)}
\label{reactor_8nxc_a6537370af17fd38a56bcf670d8db23e3}

\begin{DoxyCompactList}\small\item\em Initialize right touch sensor port ( Bumper ). \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_a4b9906c8adddf636daee1677e3172b90}{
\#define \hyperlink{reactor_8nxc_a4b9906c8adddf636daee1677e3172b90}{ACTIVE\_\-FRLIGHT}~1}
\label{reactor_8nxc_a4b9906c8adddf636daee1677e3172b90}

\begin{DoxyCompactList}\small\item\em If ==1, the front light temporarily switches to active mode. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_a8ccbe4f289c6182e18589c6f2c6108ee}{
\#define \hyperlink{reactor_8nxc_a8ccbe4f289c6182e18589c6f2c6108ee}{ST\_\-STOP}~0}
\label{reactor_8nxc_a8ccbe4f289c6182e18589c6f2c6108ee}

\begin{DoxyCompactList}\small\item\em States. Stop -\/ no movement. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_abba849981e74e84eb3836d3c03c363a9}{
\#define \hyperlink{reactor_8nxc_abba849981e74e84eb3836d3c03c363a9}{ST\_\-FWD}~1}
\label{reactor_8nxc_abba849981e74e84eb3836d3c03c363a9}

\begin{DoxyCompactList}\small\item\em States. Move forward (basic speed). \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_a82671cbfd87d61e73ed46e39a25ea515}{
\#define \hyperlink{reactor_8nxc_a82671cbfd87d61e73ed46e39a25ea515}{ST\_\-FRONTT}~6}
\label{reactor_8nxc_a82671cbfd87d61e73ed46e39a25ea515}

\begin{DoxyCompactList}\small\item\em States. Danger is ahead -\/ slowdown. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_a3744009c444a7b62295fa027e1f42a15}{
\#define \hyperlink{reactor_8nxc_a3744009c444a7b62295fa027e1f42a15}{ST\_\-SCAN}~7}
\label{reactor_8nxc_a3744009c444a7b62295fa027e1f42a15}

\begin{DoxyCompactList}\small\item\em States. Robot is scanning for the reactor. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_af8e9dc0efb6c5ba062bc1fdace7300be}{
\#define \hyperlink{reactor_8nxc_af8e9dc0efb6c5ba062bc1fdace7300be}{ST\_\-GO\_\-FOR\_\-IT}~90}
\label{reactor_8nxc_af8e9dc0efb6c5ba062bc1fdace7300be}

\begin{DoxyCompactList}\small\item\em States. Go forward for the reactor. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_a01eb7829648bea6bf8eaa82af9dacddb}{
\#define \hyperlink{reactor_8nxc_a01eb7829648bea6bf8eaa82af9dacddb}{ST\_\-SCAN\_\-GFI}~91}
\label{reactor_8nxc_a01eb7829648bea6bf8eaa82af9dacddb}

\begin{DoxyCompactList}\small\item\em States. Scanning for the reactor while in ST\_\-GO\_\-FOR\_\-IT state. \item\end{DoxyCompactList}\item 
\hypertarget{reactor_8nxc_a1c7e6cd43336e10d60f8c0635e8b7734}{
\#define \hyperlink{reactor_8nxc_a1c7e6cd43336e10d60f8c0635e8b7734}{ST\_\-FINISHED}~100}
\label{reactor_8nxc_a1c7e6cd43336e10d60f8c0635e8b7734}

\begin{DoxyCompactList}\small\item\em States. Reactor found, do nothing. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{reactor_8nxc_a9a2af8e2cd81255d3bf384db4a382807}{
task {\bfseries main} ()}
\label{reactor_8nxc_a9a2af8e2cd81255d3bf384db4a382807}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
A program allowing our robot to search for reactor. 

Definition in file \hyperlink{reactor_8nxc_source}{reactor.nxc}.

